﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AssetTracking.Theme
{
    public partial class MasterPage1 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            LabelCampus.Visible = false;
            LabelUserLogin.Text = XentrixModules.Reusable.Username();

            using (SqlEngine NewSqlEngine = new SqlEngine("AssetTracking"))
            {
            //    try
            //    {
            //        LabelScheduledUpdate.Visible = true;
            //        LabelScheduledUpdate.Text = NewSqlEngine.ExecuteProcedure("XentrixLivemaster.dbo.[Return_Application_Version]",
            //                                        new SqlEngineProcedureVariable("@AppID", WebConfigurationManager.AppSettings["AppId"].ToString())).Rows[0]["Version"].ToString();
            //    }
            //    catch
            //    {
            //    }
            }

            using (ExchangeServer Ldap = new ExchangeServer("LDAP://gloscat.ac.uk", "student", "Recycle1"))
            {
                LabelFullName.Text = LabelUserLogin.Text;
                LabelFullName.Text = Ldap.GetUsersRealName(LabelFullName.Text);
            }

            ContentPlaceHolderMain.Visible = true;
            LabelCampus.Visible = true;
            LabelCampusId.Text = XentrixModules.Reusable.CampusId();
            LabelCampus.Text = XentrixModules.Reusable.CampusName();
        }
    }
}